from oneconvert import datasource
from oneconvert.driver.base import BaseDriver


class JsonDriver(BaseDriver):
    """基于JSON字符串处理"""

    def is_matched(self):
        return True

    def handle(self):
        input_datasource = datasource.get_data_source(self.input_format, self.input_url)

        # 加载源数据
        source_data = input_datasource.read()
        print(source_data)

        # 处理数据
        # TODO

        # 持久化保存
        datasource.get_data_source(self.output_format, self.output_url).write(source_data)
